import React, {Component} from 'react';
import web3 from './utils/getWeb3';
import TabCenter from './components/TabCenter';
import {Container} from 'semantic-ui-react';

class App extends Component {
    constructor() {
        super();
        this.state = {
            currentAccount: '',
        }
    }

    async componentDidMount() {
        let accounts = await web3.eth.getAccounts();
        this.setState({currentAccount: accounts[0]});
        // let fundingArray = await contracts.fundingFactoryContract.methods.getAllFunding().call({
        //     from: accounts[0],
        // })
        //
        // console.table(fundingArray);
    }

    render() {
        let {currentAccount} = this.state;
        return (
            <Container className="App">
                <header className="App-header">
                    <h1 className="App-title">黑马众筹</h1>
                    <img src="https://api.gushi.ci/all.svg" alt="poem"/>
                    <br/>
                    <br/>
                    {
                        currentAccount && <p>您当前的账户地址: {currentAccount}</p>
                    }
                </header>
                <br/>

                <TabCenter/>
            </Container>
        );
    }

}

export default App;
